#ifndef __LCD_INIT_H
#define __LCD_INIT_H

#include "config.h"
#include "STC8G_H_GPIO.h"


#define USE_HORIZONTAL 2 
#if USE_HORIZONTAL==0||USE_HORIZONTAL==1
#define LCD_W 240
#define LCD_H 320

#else
#define LCD_W 320
#define LCD_H 240
#endif


#define BLK	P14   //接转接板的BLK
#define RES	P41  //接转接板的RES
#define CS	P42  //接转接板的CS
#define DC	P43  //接转接板的RS
#define W_R	P20  //接转接板的WR
#define R_D	P21  //接转接板的RD

#define DATAOUT	P7	 //P00~P07

#define	LCD_BLK_Set()	 BLK=1;
#define	LCD_RES_Set()	 RES=1;
#define	LCD_CS_Set()      CS=1;
#define	LCD_DC_Set()	 DC=1;
#define	LCD_WR_Set()	 W_R=1;
#define	LCD_RD_Set()	 R_D=1;

#define	LCD_BLK_Clr()	 BLK=0;
#define	LCD_RES_Clr()  RES=0;
#define	LCD_CS_Clr()   CS=0;
#define	LCD_DC_Clr()	 DC=0;
#define	LCD_WR_Clr()	 W_R=0;
#define	LCD_RD_Clr()	 R_D=0;


void LCD_GPIO_Init(void);//初始化GPIO
void LCD_Writ_Bus(u8 dat);//模拟SPI时序
void LCD_WR_DATA8(u8 dat);//写入一个字节
void LCD_WR_DATA(u16 dat);//写入两个字节
void LCD_WR_REG(u8 dat);//写入一个指令
void LCD_Address_Set(u16 x1,u16 y1,u16 x2,u16 y2);//设置坐标函数
void Lcd_Init(void);//LCD初始化
#endif




